/**   
* @Title: IndexController.java 
* @Package com.taotao.portal.controller 
* @Description: TODO(用一句话描述该文件做什么) 
* @author hekai   
* @date 2017年1月15日 下午9:42:51 
* @version V1.0   
*/
package com.taotao.portal.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.portal.service.ContentService;

/**
 * @ClassName: IndexController
 * @Description: 首页访问
 * @author hekai
 * @date 2017年1月15日 下午9:42:51
 * 
 */
@Controller
public class IndexController {
	
	@Autowired
	private ContentService contentService;
	
	@RequestMapping("/index")
	public String showIndex(Model model) {
		//取大广告位内容
		String json = contentService.getAd1List();
		//传递给页面
		model.addAttribute("ad1", json);
		return "index";
	}

	@RequestMapping(value = "/posttest", method = RequestMethod.POST)
	@ResponseBody
	public String postTest(@RequestBody Map map) {
		System.out.println(map.get("name"));
		System.out.println(map.get("pass"));
		return map.get("name") + ":" + map.get("pass");

	}
}
